package com.github.aloxc.plugin.restplus.listener;

import com.github.aloxc.plugin.restplus.i18n.I18Bundle;

import javax.swing.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/**
 *
 * @author leero
 */
public class TestResultMouseListener implements MouseListener {
    @Override
    public void mouseClicked(MouseEvent e) {
        if(e.getButton() == MouseEvent.BUTTON3){
            JPopupMenu popupMenu = new JPopupMenu();
            JMenuItem item = new JMenuItem(I18Bundle.getMessage("com.github.aloxc.plugin.restplus.test.result.clear.text"));
            popupMenu.add(item);
            item.addActionListener(ex->{
                ((JTextPane)e.getSource()).setText("");
            });
            popupMenu.show(((JTextPane)e.getSource()),e.getX(),e.getY());
        }
    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }
}
